  <script type="text/javascript">
      $(function () {
          $('#showbindlink').on('show.bs.modal', function (event) {
            var button = $(event.relatedTarget);
            var recipient = button.data('whatever');
            var modal = $(this);
            //modal.find('.modal-title').text('New message to ' + recipient)
            //modal.find('.modal-body input').val("https://open.weixin.qq.com/connect/oauth2/authorize?appid={$Think.config.WX_APPID}&redirect_uri={$Think.config.WX_BACK_URL|urlencode}&response_type=code&scope=snsapi_userinfo&state="+recipient+"#wechat_redirect");
            $.post('__URL__/getcontents',{userid:recipient},function(e){
                modal .find('tbody').html('');
                    $.each(e,function(k,v){
                        if(v.service_id==1){
                            var service_bg="color:red;";
                        }else{
                            var service_bg="";
                        }
                        $('#showbindlink').find('tbody').append('<tr class="odd gradeX"><td class="center" style="vertical-align: middle;'+service_bg+'"><center>'+v.content+'</center></td><td class="center" style="vertical-align: middle;"><center>'+v.addtime+'</center></td></tr>');
                    });
            });

            $("input[name='user_id']").val(recipient);
          });
      });

</script>
 <div class="row">
                <div class="col-lg-12">
                    <h3 class="page-header">服务列表</h3>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <!-- <button type="button" class="btn btn-success btn-xs" onclick="editurl('__APP__/Level/add');">添加新的专家等级</button> -->
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div class="dataTable_wrapper">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th><center>姓名</center></th>
                                            <th><center>电话</center></th>
                                            <th><center>邮箱</center></th>
                                            <th><center>最近记录</center></th>
                                            <th><center>最近时间</center></th>
                                            <th><center>是否有新提问</center></th>
                                            <th><center>操作</center></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <volist name="list" id="vo">
                                        <tr class="odd gradeX">
<!--                                             <td>
                                                <center>
                                                    <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#exampleModal" data-whatever="{$vo.id}">
                                                        <i class="fa fa-edit"></i>
                                                    </button>
                                                </center>
                                            </td> -->
                                            <td class="center" style="vertical-align: middle;"><center>{$vo['name']}</center></td>
                                            <td class="center" style="vertical-align: middle;"><center>{$vo['mobile']}</center></td>
                                            <td class="center" style="vertical-align: middle;"><center>{$vo['email']}</center></td>
                                            <td class="center" style="vertical-align: middle;"><center>{$vo['content']}</center></td>
                                            <td class="center" style="vertical-align: middle;"><center>{$vo['addtime']|date="Y-m-d H:i:s",###}</center></td>
                                            <td class="center" style="vertical-align: middle;">
                                                <center>
                                                   <if condition="$vo.reply eq 1">
                                                        <span class="label label-success">已回复</span>
                                                   <else />
                                                        <span class="label label-danger">要回复</span>
                                                   </if> 
                                                </center>
                                            </td>
                                            <td class="center" style="vertical-align: middle;">
                                                <center>
                                                     <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#showbindlink" data-whatever="{$vo.user_id}">
                                                        <i class="fa fa-reply"></i>
                                                    </button>
                                                </center>
                                            </td>
                                        </tr>
                                        </volist>
                                    </tbody>
                                </table>
                            </div>
                            <!-- /.table-responsive -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            {$page}
        </div>
        <div class="modal fade" id="showbindlink" tabindex="-1" role="dialog" aria-labelledby="showbindlinkLabel" aria-hidden="true">
          <div class="modal-dialog modal-lg">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="showbindlinkLabel">聊天记录</h4>
              </div>
              <div class="modal-body">
                        <div class="dataTable_wrapper">
                            <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                                <th  style="width:80%"><center>内容</center></th>
                                                <th><center>时间</center></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr class="odd gradeX">
                                            <td class="center" style="vertical-align: middle;"><center></center></td>
                                            <td class="center" style="vertical-align: middle;"><center></center></td>
                                        </tr>
                                    </tbody>
                            </table>
                        </div>

                        <form>
                          <div class="form-group">
                            <label for="recipient-name" class="control-label">回复内容</label>
                            <input type="text" class="form-control" name ="content" id="content">
                          </div>
                        </form>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-success" onclick="postcontents();">提交</button>
                <input type="hidden" name="user_id">
                <button type="button" class="btn btn-danger" data-dismiss="modal">关闭</button>
              </div>
            </div>
          </div>
        </div>
<script type="text/javascript">
    function postcontents(){
        var userid = $("input[name='user_id']").val();
        var content = $("input[name='content']").val();
        $.post('__URL__/postcontents',{userid:userid,content:content},function(x){
            if(x.status==1){
                $.post('__URL__/getcontents',{userid:userid},function(e){
                    $('#showbindlink') .find('tbody').html('');
                    $.each(e,function(k,v){
                        if(v.service_id==1){
                            var service_bg="color:red;";
                        }else{
                            var service_bg="";
                        }
                        $('#showbindlink').find('tbody').append('<tr class="odd gradeX"><td class="center" style="vertical-align: middle;'+service_bg+'"><center>'+v.content+'</center></td><td class="center" style="vertical-align: middle;"><center>'+v.addtime+'</center></td></tr>');
                    });
                    $("input[name='content']").val('');
                });                
            }
        });
    }

</script>

</body>

</html>
